Dashboard Temp Share Shortlinks Frames API

HTMLify

Find the element that appears once.cpp
Views: 1 | Author: cody
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
class Solution{
public:	
	int search(int A[], int N){
	    //code
	    int xor1 = 0;
	    for(int i=0 ;i<N; i++){
	     xor1 = xor1 ^ A[i];
	    }
	    return xor1;
	}
};